package com.xywy.fwc.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xywy.R;
import com.xywy.fwc.bean.FwcMyAddBean;

public class MyAddAdapter extends BaseAdapter {
    private List<FwcMyAddBean> list_my_add;
    private Context context;
    /**
     * 1:待审核 2:等待就诊 3:未通过审核 4:预约取消 5:成功就诊 6:爽约 7:取消就诊
     */
    private String[] status_str = {
    		"待审核",
    		"等待就诊",
    		"未通过审核",
    		"预约取消",
    		"成功就诊",
    		"爽约",
    		"取消就诊"
    };
	public MyAddAdapter(List<FwcMyAddBean> list_my_add, Context context) {
		this.list_my_add = list_my_add;
		this.context = context;
	}

	@Override
	public int getCount() {
		return list_my_add.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		ViewHolder holder;
		if(convertView == null){
			holder = new ViewHolder();
			convertView = View.inflate(context, R.layout.fwc_add_item, null);
		    holder.tv_department = (TextView) convertView.findViewById(R.id.tv_department);
		    holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
		    holder.tv_status = (TextView) convertView.findViewById(R.id.tv_status);
		    holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
		    convertView.setTag(holder);
		}else {
			holder = (ViewHolder) convertView.getTag();
		}
		FwcMyAddBean bean = list_my_add.get(position);
		holder.tv_department.setText(bean.getDepart());
		holder.tv_name.setText(bean.getExpert());
		holder.tv_time.setText(bean.getTodate());
		int status = Integer.parseInt(bean.getState());
		holder.tv_status.setText(status_str[status-1]);
		return convertView;
	}
	
	public class ViewHolder{
		public TextView tv_time;
		public TextView tv_status;
		public TextView tv_name;
		public TextView tv_department;
	}

}
